<?php
namespace frontend\controllers;

use app\models\Apply;
use Yii;
use yii\web\Controller;


/**
 * Text controller
 */
class ApplyController extends Controller
{
    public $enableCsrfValidation = false;
    //APP端客户申请
    public function actionAskfor()
    {
        if(Yii::$app->request->isPost){
            $post=Yii::$app->request->post();
            if(!empty($post['id'])){
                $model=new Apply();
                $res=$model->askapply($post);
                if($res['code']==200){
                    return json_encode(['code' => 200, 'message' => '申请成功！','data'=>'']);
                }else{
                    return json_encode(['code' => 401, 'message' => $res['message'],'data'=>$res['data']]);
                }
            }else{
                return json_encode(['code' => 401, 'message' => '参数缺失！','data'=>'']);
            }

        }
    }


}
